<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .box {
            height: 300px;
            margin: 0 auto;
            font-size: 100px;
            line-height: 300px;
            text-align: center;
        }
        #btn {
            width: 160px;
            height: 60px;
            font-size: 30px;
            line-height: 60px;
            text-align: center;
            margin: 0 auto;
            display: block; 
        }
    </style>
</head>
<body>
    <div class="box">点击按钮开始抽奖</div>
    <input type="button" value="开始" id="btn">
</body>
<script>
    // 获取元素
    var obox = document.querySelector(".box");
    var obtn = document.getElementById("btn");

    // var names = ["高翔", "赵婷婷", "李晋", "张新同", "庄家名", "李家隆", "李玉琴","范田田","思维导图","谷耀杰"];
    var names = ["面霸", "面馆", "馄饨", "牛叉", "鸡车", "水饺"];
    // 0为开始，1为停
    var i = 0;
    var t;
    obtn.onclick = function () {
        if (i === 0) {
            clearInterval(t);
            t = setInterval(function () {
                obox.innerHTML = names[random(0, names.length - 1)]
            }, 10);
            // obtn.Value = "就是这个小帅逼！"
            obtn.setAttribute("value","就是你！")
            i = 1;
        } else if (i === 1) {
            clearInterval(t);
            i=0;
            // obtn.Value = "再来一个";
            obtn.setAttribute("value","再选一个！")
        }
    }


    // 封装的随机函数
    function random(a, b) {
        return Math.round(Math.random() * (a - b) + b);
    }
</script>

</html>